import { Value } from "arkanalyzer";
import { EngineCapability, RuleContext, Location, EngineCapabilityHint, ts } from 'qvog-dsl';

import { BaseChecker } from '../checker/BaseChecker';
import { Rule } from '../model/Rule';

export type HcEngineCapability = EngineCapability<HcHint>;
export type HcRuleContext = RuleContext<HcHint>;

export interface HcHint extends EngineCapabilityHint {
    options: { use: 'ast' | 'ir' };
    config: object[];
    native: HcNative;
    issue: HcIssue;
    issueTemplate: HcIssueTemplate;
}

export interface HcAstHint extends HcHint {
    options: { use: 'ast' };
    node: ts.Node;
}

export interface HcIrHint extends HcHint {
    options: { use: 'ir' };
    node: Value;
}

export interface HcNative {
    rule: Rule;

    // Below are internal properties that shouldn't be exposed to the user.
    checker: BaseChecker;
}

export interface HcIssue {
    location: Location;
    description: string;
    severity?: number;
    docPath?: string;
}

export interface HcIssueTemplate {
    description: string;
    severity?: number;
    docPath?: string;

    [extendField: string]: any;
}
